/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.ope.bc;

import edu.upn.sigemfi.ope.be.ArqueoVentanilla;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author infzt
 */
@Stateless
public class ArqueoVentanillaFacade implements ArqueoVentanillaFacadeLocal {
    @PersistenceContext
    private EntityManager em;

    @Override
    public void create(ArqueoVentanilla arqueoVentanilla) {
        em.persist(arqueoVentanilla);
    }

    @Override
    public void edit(ArqueoVentanilla arqueoVentanilla) {
        em.merge(arqueoVentanilla);
    }

    @Override
    public void remove(ArqueoVentanilla arqueoVentanilla) {
        em.remove(em.merge(arqueoVentanilla));
    }

    @Override
    public ArqueoVentanilla find(Object id) {
        return em.find(ArqueoVentanilla.class, id);
    }

    @Override
    public List<ArqueoVentanilla> findByIdVentanilla(Long idVentanilla) {
        return em.createQuery("Select object(o) from ArqueoVentanilla as o Where o.fidOpeVentanilla.idVentanilla = ?1").setParameter(1, idVentanilla).getResultList();
    }

    @Override
    public List<ArqueoVentanilla> findAll() {
        return em.createQuery("select object(o) from ArqueoVentanilla as o").getResultList();
    }
}
